package com.example.lirisheng.springbootfinalexperiment.service;

import com.example.lirisheng.springbootfinalexperiment.entity1.ResAuthoritiesEntity;
import com.example.lirisheng.springbootfinalexperiment.entity1.ResidentEntity;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.test.annotation.Commit;
import org.springframework.transaction.annotation.Transactional;

@SpringBootTest
@Transactional
public class CheckService {

    @Autowired
    CheService cheService;

//    @Test
//    @Commit
//    public void addChe1(){
//        ResidentEntity residentEntity = new ResidentEntity();
//        residentEntity.setPassword("admin1");
//        residentEntity.setUsername("bbb");
//        ResAuthoritiesEntity resAuthoritiesEntity = new ResAuthoritiesEntity();
//        resAuthoritiesEntity.setAuthority("MINADMIN");
//        boolean flag= cheService.addChe(residentEntity,resAuthoritiesEntity);
//        System.out.println("flag:"+flag);
//    }
//
//    @Test
//    @Commit
//    public void addAdmin(){
//        ResidentEntity residentEntity = new ResidentEntity();
//        String password = new BCryptPasswordEncoder().encode("password");
//        password="{bcrypt}"+password;
//        residentEntity.setPassword(password);
//        residentEntity.setUsername("admin1");
//        ResAuthoritiesEntity resAuthoritiesEntity = new ResAuthoritiesEntity();
//        resAuthoritiesEntity.setAuthority("ADMIN");
//        boolean flag= cheService.addChe(residentEntity,resAuthoritiesEntity);
//        System.out.println("flag:"+flag);
//    }
}
